export const getLengthByCode = (string: string , limit:number = 0):[boolean  ,number] => {
  const chars = [...string];
  let realLength = 0;
  let length = 0;
  for (let i = 0; i < chars.length; i++) {
    const charCode = chars[i].charCodeAt(0);
    if (charCode >= 0 && charCode <= 128) {
      // 字母
      length += 1
    } else {
      length+=2
    }
    if (length <= limit) {
      realLength+=1
    }
  }

  return [length > limit , realLength]
}